package com.UKIT.airtickets.Service

import java.util.regex.Pattern

object ValidationUtils {

    fun checkIsEmail(email: String): Boolean {
        val emailPattern = Pattern.compile(
            "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" +
                    "\\@" +
                    "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" +
                    "(" +
                    "\\." +
                    "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +
                    ")+"
        )
        return email.matches(emailPattern.toRegex())
    }

    fun checkPasswordTrue(password: String): Boolean {
        val passwordPattern = "(?=.*[A-Za-z])(?=.*\\d)(?=.*[@#$%^&+=.])(?=\\S+$).{6,}"
        return password.matches(passwordPattern.toRegex())
    }

    fun checkUserName(userName: String): Boolean {
        return userName.length > 5
    }
}
